﻿var Message = {
    _MessageUrl: '../Ajax/SendMessage.aspx',

    Send: function ()
    {
        var touserid = $('#hidtouserid').val();
        var messagecontent = $('#txtContent').val();

        if ($.trim(touserid) == '')
        {
            alert('参数错误');
            return false;
        }
        if ($.trim(messagecontent) == '')
        {
            alert('短消息不能为空');
            return false;
        }
        $.ajax({
            type: "GET",
            url: this._MessageUrl,
            data: ({ touserid: touserid, messagecontent: messagecontent, code: Math.random() }),
            dataType: 'html',
            success: function (data)
            {
                if (data == '1')
                {
                    //window.location.href = 'Index.aspx';
                    alert('短消息发送成功');
                    window.close();
                    return false;
                }
                else if (data == '-1')
                {
                    alert('请先登录');
                }
                else
                {
                    alert('短消息发送失败');
                }
            }
        });
    }

}


function MessageReply()
{
    var prefix = "ctl00_ContentPlaceHolder1_";
    var content = document.getElementById(prefix+"txtContent");
    if (content.value.length == 0)
    {
        alert('请输入消息内容');
        content.focus();
        return false;
    }
    return true;
}